package com.egao.common.module.cooperative.entity.vo;

import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.DateUtil;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.util.Date;

/**
 * 产教融合项目活动列表对象
 * @author root
 */
@Data
public class CooperativeProjectActivityListVO {

    @ApiModelProperty("主键编号")
    private Integer id;

    @ApiModelProperty("项目ID")
    private Integer cooperativeProjectId;

    @ApiModelProperty("类型 1活动 2风采 3动态")
    private String type;

    @ApiModelProperty("审核状态 2提交 1未通过 0通过")
    private String state;

    @ApiModelProperty("审核说明")
    private String stateContent;

    @ApiModelProperty("活动发布状态 0发布 1未发布")
    private String releaseState;

    @ApiModelProperty("发布时间")
    @JsonFormat(pattern = DatePattern.NORM_DATETIME_MINUTE_PATTERN)
    private Date releaseTime;

    @ApiModelProperty("活动计划标题")
    private String titlePlan;

    @ApiModelProperty("活动预算")
    private String budget;

    @ApiModelProperty("活动计划")
    private String plan;

    @ApiModelProperty("活动标题")
    private String title;

    @ApiModelProperty("点击量")
    private Integer hits;

    @ApiModelProperty("项目名称")
    private String titleProject;

    @ApiModelProperty("活动地址")
    private String address;

    @ApiModelProperty("报名人数限制")
    private String number;

    @ApiModelProperty("报名截止时间")
    @JsonFormat(pattern = DatePattern.NORM_DATETIME_MINUTE_PATTERN)
    private Date closeTime;

    @ApiModelProperty("活动开始时间")
    @JsonFormat(pattern = DatePattern.NORM_DATETIME_MINUTE_PATTERN)
    private Date startTime;

    @ApiModelProperty("活动结束时间")
    @JsonFormat(pattern = DatePattern.NORM_DATETIME_MINUTE_PATTERN)
    private Date endTime;

    @ApiModelProperty("封面图")
    private String img;

    @ApiModelProperty("活动签到二维码")
    private String qrCode;

    @ApiModelProperty("添加时间")
    @JsonFormat(pattern = DatePattern.NORM_DATETIME_MINUTE_PATTERN)
    private Date createTime;

    @ApiModelProperty("报名总人数")
    private Integer stateCount;
    @ApiModelProperty("报名取消人数")
    private Integer stateCancelCount;
    @ApiModelProperty("报名实际人数")
    private Integer stateActualCount;
    @ApiModelProperty("签到人数")
    private Integer signCount;

    @ApiModelProperty(value = "是否过期", notes = "true是 false否")
    private Boolean overdue;

    public Boolean getOverdue() {
        // 开始时间为空 默认过期
        if (null == startTime) {
            return true;
        }

        if (System.currentTimeMillis() >= startTime.getTime()) {
            return true;
        }
        return false;
    }
}
